﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CustomSerializer.Tests
{
    [TestClass]
    public class TestInheritance : TestBase
    {
        [TestInitialize]
        public void Init()
        {
            InitSerializer();
        }

        public void SingleObject()
        {
            var o = new SimpleTypesChild(true);
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        public void Array() {
            var o = new[] {
                new SimpleTypesChild(true),
                new SimpleTypes(true),
                new SimpleTypesChild(),
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        public void ArraySparsed()
        {
            var o = new[] {
                new SimpleTypesChild(true),
                null,
                new SimpleTypes(true),
                null,
                new SimpleTypesChild(),
                null
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }

        public void ArrayMixed()
        {
            var o = new object[] {
                new MixedBaseChild(true),
                new MixedBaseChild(false),
                null,
                new SimpleTypes(true),
                new SimpleTypes(),
                null,
                new SimpleTypesChild(),
                new SimpleTypesChild(true),
                null
            };
            TestObject(ser, o);
            TestObject(serCompressed, o);
        }
    }
}